import http from '../http'

/**
 * 供应链物流信息
 */
function getDhTrackInfo(data: any) {
  return http.get('/order/api/v1/order/getDhTrackInfo', data)
}
/**
 * 供应链退款新增
 */
function refundAdd(data: any) {
  return http.post('/order/api/v1/order/product/refund/add', data)
}
//售后详情
function refundInfo(data: any) {
  return http.get('/order/api/v1/order/product/refund/info', data)
}

//取消售后
function refundCancelRefund(data: any) {
  return http.post('/order/api/v1/order/product/refund/cancelRefund', data)
}
// 售后的订单详情
function skuBaseInfo(data: any) {
  return http.get('/order/api/v1/order/product/sku/skuBaseInfo', data)
}
//售后更新
function refundUpdate(data: any) {
  return http.post('/order/api/v1/order/product/refund/update', data)
}

/**
 * 订单新增
 */
function orderAdd(data: any) {
  return http.post('/order/api/v1/order/add', data)
}
/**
 * 订单删除
 */
function orderDelete(data: any) {
  return http.get('/order/api/v1/order/delete', data)
}
/**
 * 订单详情
 */
function orderInfo(data: any) {
  return http.get('/order/api/v1/order/info', data)
}
/**
 * 订单详情
 */
function getOrderPayInfo(data: any) {
  return http.get('/order/api/v1/order/getPlaceOfPayInfo', data)
}
/**
 * 订单列表
 */
function orderList(data: any) {
  return http.get('/order/api/v1/order/list', data)
}
/**
 * 出餐详情接口
 */
function getHwOrderInfoLatest(data?: any) {
  return http.get('/order/api/v1/order/getHwOrderInfoLatest', data)
}
/**
 * 订单金额
 */
function orderMoney(data: any) {
  return http.post('/order/api/v1/order/money', data)
}
/**
 * 订单支付
 */
function orderPay(data: any) {
  return http.post('/order/api/v1/order/pay', data)
}
/**
 * 订单更新
 */
function orderUpdate(data: any) {
  return http.post('/order/api/v1/order/update', data)
}

function userStatisticsInfo(data: { userId: string }) {
  return http.get('/order/api/v1/user/statistics/info', data)
}
function userStatisticsList(data: { userId: string }) {
  return http.get('/order/api/v1/user/statistics/list', data)
}
function userStatisticsUserInfo(data: { userId: string }) {
  return http.get('/order/api/v1/user/statistics/user/info', data)
}
function userStatisticsUserList(data: { userId: string }) {
  return http.get('/order/api/v1/user/statistics/user/list', data)
}
function userStatisticsDepartmentInfo(data: { userId: string }) {
  return http.get('/order/api/v1/user/statistics/department/info', data)
}
function shopStatisticsInfo(data: { userId: string }) {
  return http.get('/order/api/v1/order/statistics/shop/shop/info', data)
}
function orderStatisticUserList(data: { userId: string }) {
  return http.get('/order/api/v1/order/statistics/user/list', data)
}

// 加油计算优惠
function oilCalculate(data: any) {
  return http.post('/order/api/v1/order/oilCalculate', data)
}


//海威第三方状态码
export const HW_ORDER_STATUS = {
  WAIT_OUT_MEAL: 0, //待支付
  WAIT_DELIVER: 1, //待发货
  WAIT_RECEIVE: 2, //待收货
  WAIT_COMMENT: 3, //待评价
  FINISH: 4, //完成
  CANCEL: 5, //取消
  REFUND: 6 //退款
}

export default {
  oilCalculate,
  getDhTrackInfo,
  refundUpdate,
  refundCancelRefund,
  skuBaseInfo,
  refundInfo,
  refundAdd,
  orderAdd,
  orderDelete,
  orderInfo,
  getOrderPayInfo,
  orderList,
  getHwOrderInfoLatest,
  orderMoney,
  orderPay,
  orderUpdate,
  userStatisticsInfo,
  userStatisticsList,
  userStatisticsUserInfo,
  shopStatisticsInfo,
  userStatisticsUserList,
  orderStatisticUserList,
  userStatisticsDepartmentInfo
}
